package com.lagou.edu.controller;

import com.lagou.edu.service.MailService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/api/email")
@RefreshScope
public class MailController {

    @Autowired
    private MailService mailService;

    @RequestMapping("/{email}/{code}")
    public String sendMail(@PathVariable("email")String email, @PathVariable("code")String code) {
        mailService.sendMail(email, "您本次操作验证码", code);
        return "true";
    }
}
